<?php

class Bookmaker extends AppModel {

    var $useTable = 'bookmaker'; // nome della tabella
    public $actsAs = array('Lang');
    // public $actsAs = array(
        // 'Translate' => array(
            // 'descrizione'
        // ));
        
	public $hasMany = array(
	            'Links' => array(
                'className' =>'Link' 
                ,'foreignKey' =>'bookmaker_id'
                ),
                'BookmakerLang' => array(
                'className' =>'BookmakerLang'
                ,'foreignKey' =>'reference_id'
                ),
                'Pagamento' => array(
                'className' =>'Pagamento'
                ,'foreignKey' =>'bookmaker_id'
                )
    );

	public $belongsTo = array(
	        'Logo' => array(
	            'className'    => 'Attach' 
	            ,'foreignKey' => 'logo'
	        ) 
	        ,'LogoSlim' => array(
	            'className'    => 'Attach' 
	            ,'foreignKey' => 'logo_slim'
	        ) 
	);
		
	public function beforeSave($options = array()) {
		if (parent::beforeSave($options)) {
			// pr($this->data);
			// die;
			$this->set("nome_slug",StringUtil::StringToSlug($this->data["Bookmaker"]["nome"]));
			return true;
		} else
			return false;
	}
		
}

?>